/**
 * VYPe11 Project
 * VYPe11 language compiler.
 * Authors: Jozef Lang (xlangj01), 
 * 			Zoltan Zemko (xzemko01)
 * 2011
 */
package cz.vutbr.fit.VYPe.team18.VYPe11.nodes.statement;

import java.io.IOException;

import cz.vutbr.fit.VYPe.team18.VYPe11.nodes.IdentifierNode;
import cz.vutbr.fit.VYPe.team18.VYPe11.nodes.expression.ExpressionNode;

public class AssigmentStatementNode extends StatementNode {
	IdentifierNode id;
	private ExpressionNode expression;
		
	public AssigmentStatementNode(IdentifierNode id,
								ExpressionNode expr) {
		this.id=id;
		this.expression=expr;
	}

	public IdentifierNode getIdentifier() {
		return id;
	}
	
	public ExpressionNode getExpression() {
		return expression;
	}

	@Override
	public void generateTAC() throws IOException {
		expression.generateTAC();
		int i=tacCounter.getTermIndex()-1;
		this.writeTAC("=", "_t"+i, "", id.getId());
	}
}
